<template lang="">
    <div>
        <myheader/>
        展示我的文件列表
        <table>
            <tr>
                <td>名称</td>
                <td>图片</td>
                <td>操作</td>
            </tr>
            <tr v-for='i in filelist'>
                <td>{{i.name}}</td>
                <td>
                        <van-image
                      
                        width="10rem"
                        height="10rem"
                        :src="i.url"
                      />
                </td>
                <td>
                    <van-button @click='del(i.name)'>删除</van-button>
                    </td>
            </tr>
        </table>
       
    </div>
</template>
<script>
import myheader from '@/components/myheader'
export default {
    data(){
        return{
            filelist:[],
            userid:localStorage.getItem('userid')
        }
    },
    methods: {
        getFilelist(){
            this.$axios.get('users/getFiles?userid='+this.userid).then(res=>{
                this.filelist=res.data.list
            })
        },
        //删除
        del(name){
            this.$axios.delete('users/getFiles?userid='+this.userid+'&filename='+name).then(res=>{
               this.getFilelist()
            })
        }
    },
    mounted() {
        this.getFilelist()
    },
    components:{
        'myheader':myheader
    }
}
</script>
<style lang="">
    
</style>